require('./run.less')

require('../../assets/css/normalize.css')
require('../../assets/css/reset.css')
require('../../assets/css/property.css')
require('../../assets/css/basic.css')

//引入字体图标
require('../../libs/fonts/iconfont.css')

//引入dom.js
const { $, g, ga } = require('../../utlis/dom')

//引入axios
const axios = require('axios')
require('../../utlis/axios')


//引入底部导航
const { showNav, showtopNav } = require('../../utlis/footer-')
showNav('run')
showtopNav('run')


$(function () {
    // 地图初始化应该在地图容器div已经添加到DOM树之后
    var map = new AMap.Map('container', {
        zoom: 12,
        center: [104.066301, 30.572961],//中心点坐标
        viewMode: '3D'//使用3D视图
    })

    axios.get('/api/exercise').then(function (res) {
        if (res.data.errno === 0) {
            console.log(res)
            kilometre.textContent = (res.data.data.sum7Meter / 1000).toFixed(1)
        }
    })

    //点击倒计时
    btn.addEventListener('click', function () {
        g('.mask').style.display = 'flex'
        let time = 3
        setInterval(function () {
            --time
            if (time < 0) {
                location.href = './motion.html'
                return
            }
            g('.three').textContent = time > 0 ? time : 'GO'
        }, 1000)
    })
})

